<!--#INCLUDE FILE="config.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- DATE PICKER SCRIPT -->
<link type="text/css" href="../css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript">
	// ***** Session Timeout Warning and Redirect mReschke 2010-09-29 ***** //
function InitSessionTimer() {
    /* mReschke 2010-09-29 */
    warn_sec = <%=session.timeout%> * 60 * 1000;   	//Warning time in milliseconds
    timeout_sec = <%=session.timeout%> * 60 * 1000 + 60000;          //Actual timeout in milliseconds
    show_warning = true;
    epoch = new Date().getTime();
    CheckSessionStatus();
}
InitSessionTimer();
function CheckSessionStatus() {
    /* mReschke 2010-09-29 */
 
    //Check for session warning
    epoch2 = new Date().getTime();
     if (epoch2 > epoch + timeout_sec) {
        alert("Your session has timed out.");
        window.location.href = 'default.asp?msg=invalid_out';
    } else {
        down = setTimeout("CheckSessionStatus();", 2000);
    }
}
</script>
<script type="text/javascript">
$(function() {
    $('#list_table tr:nth-child(2n+1)').addClass('alternate');
});
</script>
<%
if(Session("SalesAccessLevel") <> 1 and Session("SalesAccessLevel") <> 4 ) then
	Response.Redirect("default.asp?msg=invalid")
end if
%>
  

<title>Sales Panel de Control :: CostaBaja</title>

</head>

<body>

<div id="main_wrapper">
    	<div class="main_wrapper_margin">
        	
            <div class="admin_top_menu">
			<%
				if(Session("SalesAccessLevel") = 4 ) then
			%>
            <!--#INCLUDE FILE="sales_menu_manage.asp"--> 
			<%
				else
			%>
			<!--#INCLUDE FILE="sales_menu.asp"--> 
			<%
				end if
			%>
           	</div><!-- END admin_top_menu -->
             
			<h1>Panel de Control</h1>
            <div class="clear"></div>
            
            
            
            <div class="dashboad_wrapper">
              
  <table id="list_table" width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr class="titles">
    <td>Actividad/Activity</td>
    <td>Prospect</td>
    <td>Fecha/Date</td>
	<td>Visita fecha/Visit Date</td>
     <td>&nbsp;</td>
  </tr>
<%
	if(Session("SalesId") <> "") then
		SaleID = Session("SalesId")
	else 
		SaleID = 0
	end if
		
	set objConnect1 = server.createObject("ADODB.Connection")   

	objConnect1.Open conStr

	
	strQuery1 = "SELECT G.GuestID, G.Name, G.Surname, S.ScheduceCallID,"
	strQuery1 = strQuery1 & " dbo.GetActivity(CONVERT(VARCHAR(10),V.Datetime,101),CONVERT(VARCHAR(10),S.Date,101),GETDATE()) AS Activity,"
	strQuery1 = strQuery1 & " ISNULL(CONVERT(VARCHAR(10),V.Datetime,101),'') AS VisitDate, ISNULL(CONVERT(VARCHAR(10),S.Date,101),'') AS Fercha"
	strQuery1 = strQuery1 & " FROM Guests G"
	strQuery1 = strQuery1 & " LEFT JOIN VisitCalendar V ON G.GuestID = V.GuestID"
	strQuery1 = strQuery1 & " LEFT JOIN ScheduleCall S ON G.GuestID = S.GuestID"
	strQuery1 = strQuery1 & " WHERE G.IsGuest = 0 AND ((S.ScheduceCallID IS NOT NULL AND V.VisitCalendarID IS NULL ) OR (V.VisitCalendarID IS NOT NULL AND CONVERT(VARCHAR(10),V.Datetime,1) >= CONVERT(VARCHAR(10),GETDATE(),1))) AND G.SaleID = " & SaleID
	set TblTemp1 = server.createobject("Adodb.Recordset")
		
	TblTemp1.Open strQuery1, objConnect1
		
	Do Until TblTemp1.EOF
		GuestID = TblTemp1("GuestID")
		FirstName = TblTemp1("Name")
		LastName = TblTemp1("Surname")		
		Activity = TblTemp1("Activity")
		Fercha = TblTemp1("Fercha")
		VisitDate = TblTemp1("VisitDate")
		ScheduceCallID = TblTemp1("ScheduceCallID")
%>

  <tr>
    <td>
	<%
		if(Activity = "Call") then
	%>
	<a href="sales-call-update-reschedule.asp?shID=<%=ScheduceCallID%>">Call</a>
	<%
	else
	%>
		<%=Activity%>
	<%
	end if
	%>
	</td>
    <td><%=FirstName & " " & LastName%></td>
    <td><%=Fercha%></td>
    <td><%=VisitDate%></td>
	 <td><a href="sales-prospect-profile-page.asp?pID=<%=GuestID%>">Ver / View</a></td>
  </tr>
   <%
	TblTemp1.MoveNext
	Loop
  %> 
</table>

<!--<img src="../images/hover_prospect.jpg"/>
            
            </div><!-- .dashboad_wrapper -->
                        
    	</div><!-- END .main_wrapper_margin -->
        
	</div><!-- END #main_wrapper -->

         <!-- FOOTER -->
         
         <!--#INCLUDE file="sales_footer.asp"-->
         
         <!-- END FOOTER -->   

</body>
</html>
